﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.SessionState;

namespace Zoo.Cat.ImageWeb
{
    /// <summary>
    /// ImageHandler 的摘要说明
    /// </summary>
    public class ImageHandler : IHttpHandler, IRequiresSessionState
    {

        public void ProcessRequest(HttpContext context)
        {
            if (context == null)
            {
                return;
            }

            context.Response.ContentType = "image/jpeg";

            context.Response.Cache.SetCacheability(HttpCacheability.Public);
            context.Response.BufferOutput = false;

            string fileId = context.Request.QueryString["ImageId"] as string;
            if (fileId != null && !string.IsNullOrWhiteSpace(fileId))
            {
                // 查询数据
                //var fileItem = 

                //if (fileItem != null && fileItem.FileContent != null)
                //{
                //    context.Response.OutputStream.Write(fileItem.FileContent, 0, fileItem.FileContent.Count());
                //}
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}